﻿using System;
using System.Text;

namespace HslCommunication.Profinet.Beckhoff
{
	/// <summary>
	/// Ads设备的相关信息，主要是版本号，设备名称<br />
	/// Information about Ads devices, primarily version numbers, device names.
	/// </summary>
	// Token: 0x020000B1 RID: 177
	public class AdsDeviceInfo
	{
		/// <summary>
		/// 实例化一个默认的对象<br />
		/// Instantiate a default object
		/// </summary>
		// Token: 0x06000CDF RID: 3295 RVA: 0x00015527 File Offset: 0x00013727
		public AdsDeviceInfo()
		{
		}

		/// <summary>
		/// 根据原始的数据内容来实例化一个对象<br />
		/// Instantiate an object based on the original data content
		/// </summary>
		/// <param name="data">原始的数据内容</param>
		// Token: 0x06000CE0 RID: 3296 RVA: 0x0004C6BC File Offset: 0x0004A8BC
		public AdsDeviceInfo(byte[] data)
		{
			this.Major = data[0];
			this.Minor = data[1];
			this.Build = BitConverter.ToUInt16(data, 2);
			this.DeviceName = Encoding.ASCII.GetString(data.RemoveBegin(4)).Trim(new char[]
			{
				'\0',
				' '
			});
		}

		/// <summary>
		/// 主版本号<br />
		/// Main Version
		/// </summary>
		// Token: 0x170001EE RID: 494
		// (get) Token: 0x06000CE1 RID: 3297 RVA: 0x0004C71B File Offset: 0x0004A91B
		// (set) Token: 0x06000CE2 RID: 3298 RVA: 0x0004C723 File Offset: 0x0004A923
		public byte Major { get; set; }

		/// <summary>
		/// 次版本号<br />
		/// Minor Version
		/// </summary>
		// Token: 0x170001EF RID: 495
		// (get) Token: 0x06000CE3 RID: 3299 RVA: 0x0004C72C File Offset: 0x0004A92C
		// (set) Token: 0x06000CE4 RID: 3300 RVA: 0x0004C734 File Offset: 0x0004A934
		public byte Minor { get; set; }

		/// <summary>
		/// 构建版本号<br />
		/// Build version
		/// </summary>
		// Token: 0x170001F0 RID: 496
		// (get) Token: 0x06000CE5 RID: 3301 RVA: 0x0004C73D File Offset: 0x0004A93D
		// (set) Token: 0x06000CE6 RID: 3302 RVA: 0x0004C745 File Offset: 0x0004A945
		public ushort Build { get; set; }

		/// <summary>
		/// 设备的名字<br />
		/// Device Name
		/// </summary>
		// Token: 0x170001F1 RID: 497
		// (get) Token: 0x06000CE7 RID: 3303 RVA: 0x0004C74E File Offset: 0x0004A94E
		// (set) Token: 0x06000CE8 RID: 3304 RVA: 0x0004C756 File Offset: 0x0004A956
		public string DeviceName { get; set; }
	}
}
